'use strict';

const Controller = require('egg').Controller;

class StudyController extends Controller {
  /**
   * 获取详情数据
   */
  async imageUp() {
    const { ctx } = this;
    const [ file ] = ctx.request.files;
    if (file) {
      file.serverPath = `/webnuxt-api${file.filepath.split('app')[1]}`;
      ctx.sendSuccess(file);
    } else {
      throw new Error('请确定是否有文件上传');
    }
  }
}

module.exports = StudyController;
